#include<iostream>
using namespace std;
void get_next(string s, int next[])
{
	int j = 0;
	int k = -1;
	next[0] = -1;
	for (; j < s.size(); j++) {
		if (k == -1 || s[j] == s[k]) {
			j++;
			k++;
		    next[j]=k;
		}
		else {
			k = next[k];
		}
	}
}
bool Is_ZiC(string s1, string s2)
{
	int j = 0;
	int i = 0;
	int next[300];
	get_next(s2, next);
	while (i < s1.size() && j < s2.size()) {
		if (j == -1 || s1[i] == s2[j]) {
			i++;
			j++;
		}
		else {
			j = next[j];
		}
	}
	if (j == s2.size()) {
		return true;
	}
	return false;
}
int main()
{
	string s1, s2;
	cin >> s1 >> s2;
	if (Is_ZiC(s1, s2)) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}